package com.chinacoal.microservice.mapper;

import com.baomidou.mybatisplus.mapper.BaseMapper;
import com.baomidou.mybatisplus.plugins.Page;
import com.chinacoal.microservice.pojo.CcmsSmartleasingExpenseManag;
import com.chinacoal.microservice.pojo.ExpenseImport;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @author zhuliang
 * @version V1.0
 * @Description: 费用管理-mybatis-plus接口类
 * @date 2020-11-27 9：38
 */
public interface CcmsSmartleasingExpenseManagMapper extends BaseMapper<CcmsSmartleasingExpenseManag> {
    
    /**
     * @Description: 查询所有的费用信息带分页
     * @author zhuliang
     * @date 2020/11/27 10:15
     */
    List<CcmsSmartleasingExpenseManag> getAllByPage(Page<CcmsSmartleasingExpenseManag> toPage,
                                                    @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                                    @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    List<CcmsSmartleasingExpenseManag> getAll(@Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                                    @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 查询所有的总记录数
     * @author zhuliang
     * @date 2020/11/27 10:17
     */
    Long getAllByPage_COUNT(@Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                            @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 条件查询所有的总记录数
     * @author zhuliang
     * @date 2020/11/27 11:12
     */
    Long getAllByCondition_COUNT(@Param("houseNumber") String houseNumber,
                                 @Param("unitCoding") String unitCoding,
                                 @Param("paymentStatus") String paymentStatus,
                                 @Param("paymentTime") Date paymentTime,
                                 @Param("inputString") String inputString,
                                 @Param("invoiceStatus") String invoiceStatus,
                                 @Param("fkLessorId") String fkLessorId,
                                 @Param("fkBuildingId") String fkBuildingId,
                                 @Param("contactPhone") String contactPhone,
                                 @Param("statisticsMonth") Date statisticsMonth,
                                 @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                 @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 条件查询所有的费用信息带分页
     * @author zhuliang
     * @date 2020/11/27 11:15
     */
    List<CcmsSmartleasingExpenseManag> getAllByCondition(@Param("houseNumber") String houseNumber,
                                                         @Param("unitCoding") String unitCoding,
                                                         @Param("paymentStatus") String paymentStatus,
                                                         @Param("paymentTime") Date paymentTime,
                                                         @Param("inputString") String inputString,
                                                         @Param("invoiceStatus") String invoiceStatus,
                                                         @Param("fkLessorId") String fkLessorId,
                                                         @Param("fkBuildingId") String fkBuildingId,
                                                         @Param("contactPhone") String contactPhone,
                                                         @Param("statisticsMonth") Date statisticsMonth,
                                                         @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                                         @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId,
                                                         Page<CcmsSmartleasingExpenseManag> toPage);

    /**
     * @Description: 通过费用信息id得到要抄表所需要回显的信息
     * @author zhuliang
     * @date 2020/11/27 14:13
     */
    CcmsSmartleasingExpenseManag getMeterReadingByExpenseManagId(@Param("pkExpenseManagId") String pkExpenseManagId,
                                                                 @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                                                 @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    /**
     * @Description: 批量添加
     * @author zhuliang
     * @date 2020/11/27 15:12
     */
    void batchAdd(List<CcmsSmartleasingExpenseManag> expenseManagList);

    /**
     * @Description: 根据费用信息id修改开票状态
     * @author zhuliang
     * @date 2020/12/9 10:13
     */
    void updateByInvoice(@Param("lastUpdateDate") Date lastUpdateDate,
                         @Param("lastUpdatedBy")Integer lastUpdatedBy,
                         @Param("invoiceStatus") String invoiceStatus,
                         @Param("pkExpenseManagId") String pkExpenseManagId);

    /**
     * @Description: 根据费用信息id修改房租发票开票状态
     * @author zhuliang
     * @date 2020/12/9 10:13
     */
    void updateByMonthlyInvoice(@Param("lastUpdateDate") Date lastUpdateDate,
                                @Param("lastUpdatedBy")Integer lastUpdatedBy,
                                @Param("monthlyInvoiceStatus") String monthlyInvoiceStatus,
                                @Param("pkExpenseManagId") String pkExpenseManagId);

    /**
     * @Description: 查询所有未缴费的租户id
     * @author zhuliang
     * @date 2020/12/10 19:31
     */
    List<String> getAllTenantIdByPay();

    /**
     * @Description: 微信端-所有已缴费费用信息(带分页)
     * @author zhuliang
     * @date 2020/12/23 12:05
     */
    List<CcmsSmartleasingExpenseManag> getAllByWechat(@Param("firstPage") Integer firstPage,
                                                      @Param("endPage")Integer endPage,
                                                      @Param("contactPhone") String contactPhone);

    /**
     * @Description: 微信端-所有未缴费费用信息
     * @author zhuliang
     * @date 2020/12/23 14:42
     */
    List<CcmsSmartleasingExpenseManag> getUnpaidFeesByWechat(@Param("contactPhone") String contactPhone);

    /**
     * @Description: 抄表，获得第三方设备读数信息
     * @author zhuliang
     * @date 2021/1/29 14:53
     */
    CcmsSmartleasingExpenseManag getDeviceReadings(@Param("pkRoomId") String pkRoomId);

    /**
     * @Description: 修改开票状态
     * @author zhuliang
     * @date 2021/3/26 16:25
     */
    void updateInvoiceStatus(@Param("lastUpdateDate") Date lastUpdateDate,
                             @Param("lastUpdatedBy")Integer lastUpdatedBy,
                             @Param("invoiceStatus") String invoiceStatus,
                             @Param("fkInvoiceRecordId") String fkInvoiceRecordId);

    /**
     * @Description: 修改房租发票开票状态
     * @author zhuliang
     * @date 2021/3/26 16:25
     */
    void updateMonthlyInvoiceStatus(@Param("lastUpdateDate") Date lastUpdateDate,
                                     @Param("lastUpdatedBy")Integer lastUpdatedBy,
                                     @Param("invoiceStatus") String invoiceStatus,
                                     @Param("fkInvoiceRecordId") String fkInvoiceRecordId);

    /**
     * @Description: 修改总发票开票状态
     * @author zhuliang
     * @date 2021/3/26 16:25
     */
    void updateTotalInvoiceStatus(@Param("lastUpdateDate") Date lastUpdateDate,
                                    @Param("lastUpdatedBy")Integer lastUpdatedBy,
                                    @Param("invoiceStatus") String invoiceStatus,
                                    @Param("fkInvoiceRecordId") String fkInvoiceRecordId);


    long getNoAuditCount(@Param("statisticsMonth") String statisticsMonth,
                         @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                         @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    List<ExpenseImport> queryNoMeterData(@Param("statisticsMonth")String statisticsMonth, @Param("lastStatisticsMonth") String lastStatisticsMonth);

    List<CcmsSmartleasingExpenseManag> getAllByCondition(@Param("houseNumber") String houseNumber,
                                                         @Param("unitCoding") String unitCoding,
                                                         @Param("paymentStatus") String paymentStatus,
                                                         @Param("paymentTime") Date paymentTime,
                                                         @Param("inputString") String inputString,
                                                         @Param("invoiceStatus") String invoiceStatus,
                                                         @Param("fkLessorId") String fkLessorId,
                                                         @Param("fkBuildingId") String fkBuildingId,
                                                         @Param("contactPhone") String contactPhone,
                                                         @Param("statisticsMonth") Date statisticsMonth,
                                                         @Param("fkPropertyCompanyId") String fkPropertyCompanyId,
                                                         @Param("fkAdministrativeOfficeId") String fkAdministrativeOfficeId);

    BigDecimal getWaterReading(@Param("pkRoomId") String pkRoomId);

    BigDecimal getElectricReading(@Param("pkRoomId") String pkRoomId);

    BigDecimal getHotWaterReading(@Param("pkRoomId") String pkRoomId);
}
